package com.itheima.ArrayStudy;

import java.util.Scanner;

public class ArrayDemo2 {
    public static void main(String[] args) {
        test();
    }

    public static void test() {
        double[] arr = new double[4];
        Scanner sc = new Scanner(System.in);
        for (int i = 0; i < arr.length; i++) {
            System.out.println("请输入成绩");
            arr[i] = sc.nextDouble();
        }

        double sum = 0;
        for (int i = 0; i < arr.length; i++) {
            sum += arr[i];
        }
        System.out.println("平均分是：" + String.format("%.2f", (double) sum / arr.length));


        double max = arr[0];
        for (int i = 0; i < arr.length; i++) {
            if (max < arr[i]) {
                max = arr[i];
            }
        }
        System.out.println("最高分是：" + max);
    }
}
